from flask import Flask, escape
app = Flask(__name__)

# 变量规则
# https://flask.net.cn/quickstart.html#id7

# example:127.0.0.1:5000/user/yymicro
@app.route('/user/<username>')
def show_user_profile(username):
    # show the user profile for that user
    return 'User %s' % escape(username)

# example:http://127.0.0.1:5000/post/5
@app.route('/post/<int:post_id>')
def show_post(post_id):
    # show the post with the given id, the id is an integer
    return 'Post %d' % post_id

# example:http://127.0.0.1:5000/path/subpath
@app.route('/path/<path:subpath>')
def show_subpath(subpath):
    # show the subpath after /path/
    return 'Subpath %s' % escape(subpath)